package academia.gui;


import java.awt.EventQueue;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.TextField;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;


import academia.negocio.Cadastro;

import academia.negocio.TelasOperadores;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import java.awt.Color;

public class TelaDadosCliente extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */


	/**
	  
	 */
	
	public TelaDadosCliente() {
		
		setTitle("Dados do Cliente");
		setAlwaysOnTop(true);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		getContentPane().setBackground(SystemColor.inactiveCaptionBorder);
		getContentPane().setFont(new Font("Tahoma", Font.BOLD, 11));
		getContentPane().setForeground(SystemColor.controlShadow);
		setBounds(100, 100, 450, 300);
		
		JLabel lblNome = new JLabel("Nome");
		lblNome.setBounds(30, 13, 32, 16);
		lblNome.setFont(new Font("Dialog", Font.BOLD, 11));
		lblNome.setForeground(SystemColor.controlShadow);
		
		JLabel lblCpf = new JLabel("CPF");
		lblCpf.setBounds(40, 40, 21, 15);
		lblCpf.setForeground(SystemColor.controlShadow);
		lblCpf.setFont(new Font("Dialog", Font.BOLD, 11));
		
		JLabel lblCep = new JLabel("CEP");
		lblCep.setBounds(41, 66, 21, 15);
		lblCep.setForeground(SystemColor.controlShadow);
		lblCep.setFont(new Font("Dialog", Font.BOLD, 11));
		
		JLabel lblCidade = new JLabel("Cidade");
		lblCidade.setBounds(23, 95, 39, 16);
		lblCidade.setForeground(SystemColor.controlShadow);
		lblCidade.setFont(new Font("Dialog", Font.BOLD, 12));
		
		JLabel lblNewLabel = new JLabel("Bairro");
		lblNewLabel.setBounds(29, 122, 33, 15);
		lblNewLabel.setForeground(SystemColor.controlShadow);
		lblNewLabel.setFont(new Font("Dialog", Font.BOLD, 11));
		
		JLabel lblEndereco = new JLabel("Endereco");
		lblEndereco.setBounds(10, 179, 52, 15);
		lblEndereco.setForeground(SystemColor.controlShadow);
		lblEndereco.setFont(new Font("Dialog", Font.BOLD, 11));
		
		JLabel lblDataDeNascimento = new JLabel("Data de nascimento");
		lblDataDeNascimento.setBounds(226, 67, 108, 22);
		lblDataDeNascimento.setForeground(SystemColor.controlShadow);
		lblDataDeNascimento.setFont(new Font("Dialog", Font.BOLD, 11));
		
		JLabel lblTelefone = new JLabel("Telefone");
		lblTelefone.setBounds(10, 151, 49, 15);
		lblTelefone.setForeground(SystemColor.controlShadow);
		lblTelefone.setFont(new Font("Dialog", Font.BOLD, 11));
		
		final TextField textNome = new TextField();
		textNome.setBounds(68, 14, 98, 22);
		getContentPane().add(textNome);
		
		final TextField textCpf = new TextField();
		textCpf.setBounds(68, 39, 98, 22);
		getContentPane().add(textCpf);
		
		final TextField textCep = new TextField();
		textCep.setBounds(68, 67, 98, 22);
		getContentPane().add(textCep);
		
		final TextField textCidade = new TextField();
		textCidade.setBounds(68, 95, 98, 22);
		getContentPane().add(textCidade);
		
		final TextField textBairro = new TextField();
		textBairro.setBounds(68, 123, 98, 22);
		getContentPane().add(textBairro);
		
		final TextField textEndereco = new TextField();
		textEndereco.setBounds(68, 179, 266, 22);
		getContentPane().add(textEndereco);
		
		final TextField textSenha = new TextField();
		textSenha.setBounds(351, 39, 73, 22);
		getContentPane().add(textSenha);
		
		final TextField textTelefone = new TextField();
		textTelefone.setBounds(68, 151, 98, 22);
		getContentPane().add(textTelefone);
		
		final TextField textNascimento = new TextField();
		textNascimento.setBounds(351, 67, 73, 22);
		getContentPane().add(textNascimento);
		
		final TextField textCref = new TextField();
		textCref.setBounds(351, 14, 73, 22);
		getContentPane().add(textCref);
		
		JLabel lblSenha = new JLabel("Senha");
		lblSenha.setBounds(300, 39, 34, 22);
		lblSenha.setForeground(SystemColor.controlShadow);
		lblSenha.setFont(new Font("Dialog", Font.BOLD, 11));
		
		
		getContentPane().setLayout(null);
		getContentPane().add(lblNewLabel);
		getContentPane().add(lblCidade);
		getContentPane().add(lblEndereco);
		getContentPane().add(lblCpf);
		getContentPane().add(lblNome);
		getContentPane().add(lblCep);
		getContentPane().add(lblSenha);
		getContentPane().add(lblDataDeNascimento);
		getContentPane().add(lblTelefone);
	
		
		final TelasOperadores telasOperadores = new TelasOperadores();
		telasOperadores.dadosTextBox(textNome, textCpf, textBairro, textCep, textCidade, textEndereco, textNascimento, textSenha, textTelefone);
		
		JButton btnMenu = new JButton("Menu");
		btnMenu.setBounds(10, 228, 73, 23);
		btnMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new MenuRoot().setVisible(true);
				dispose();
			}
		});
		getContentPane().add(btnMenu);
		
		
		JLabel lblCref = new JLabel("Cref");
		lblCref.setForeground(SystemColor.controlShadow);
		lblCref.setFont(new Font("Dialog", Font.BOLD, 11));
		lblCref.setBounds(300, 14, 34, 22);
		getContentPane().add(lblCref);
		
		final JLabel lblStatus = DefaultComponentFactory.getInstance().createLabel("Dados atualizados com sucesso");
		lblStatus.setFont(new Font("Tahoma", Font.BOLD, 11));
		lblStatus.setForeground(Color.GREEN);
		lblStatus.setBounds(220, 123, 187, 41);
		getContentPane().add(lblStatus);
		lblStatus.setVisible(false);
		
		JButton btnAtualizar = new JButton("Atualizar");
		btnAtualizar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				Cadastro cadastro = new Cadastro();
				cadastro.cadastrar(cadastro.dadosInstrutor(textNome.getText(), textCpf.getText(), textNascimento.getText(), 
									textTelefone.getText(), textCep.getText(), textEndereco.getText(), textCidade.getText(),
									textBairro.getText(), textSenha.getText(),textCref.getText()));
				new DadosAlterados().setVisible(true);
				dispose();

			}
		});
		btnAtualizar.setBounds(335, 228, 89, 23);
		getContentPane().add(btnAtualizar);
		
		

	}
}


